package labb2.del2;

/**
 * @author Mikko Puustinen
 * @version 0.1, 2007-okt-01
 */
public enum MenuChoices {
    add, searchi, searcht, searcha, list, save, load, print, help, info, exit, novalue;

    public static MenuChoices toChoice(String str) {
        try {
            return valueOf(str);
        } catch (Exception e) {
            return novalue;
        }
    }

    public static String add() {
        return "add\t\t[optional: book title]\tAdd book to collection\n";
    }

    public static String searchi() {
        return "searchi\t[isbn]\tSearch by ISBN\n";
    }

    public static String searcht() {
        return "searcht\t[title]\tSearch by title\n";
    }

    public static String searcha() {
        return "searcha\t[author]\tSearch by author\n";
    }

    public static String list() {
        return "list\tList all books\n";
    }

    public static String save() {
        return "save\t[optional: path]\tSave collection\n";
    }

    public static String load() {
        return "load\t[optional: path]\tLoad collection\n";
    }

    public static String print() {
        return "print\t[optional: isbn/title/author]\tCreates a printer-friendly file. " +
            "If parameters are included only the chosen information will be shown\n";
    }

    public static String info() {
        return "info\tVersion info\n";
    }

    public static String exit() {
        return "exit\tExit program";
    }

    public static String help() {
        return "FtpCommands:\n\n" + add() + searchi() + searcht() + searcha() + list() + save() + load() + print() + info() + exit();
    }
}
